package com.link.base.base.consumer.service;

import com.link.base.base.consumer.exception.RepeatOrderNoException;
import com.link.base.base.consumer.model.ImpOrder;
import com.link.core.basic.query.QueryParams;
import com.link.core.basic.service.BasicService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 根据导入电商订单生成消费者
 * @author Li Yang
 */
public interface ImpData2AccntService extends BasicService<ImpOrder> {

    /**
     * 根据导入的订单生成消费者
     * @param orderSouce
     * @param qps
     * @param request
     * @return
     * @throws Exception
     * @throws RepeatOrderNoException
     */
    public String generateAccntFromOrder(String orderSouce, QueryParams qps, HttpServletRequest request) throws Exception, RepeatOrderNoException;

    /**
     * 查询当前用户所插入临时表的订单头
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<ImpOrder> queryImportOrderHeadPage(ImpOrder record) throws Exception;

    /**
     * 查询当前用户所插入临时表的订单行
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<ImpOrder> queryImportOrderItemPage(ImpOrder record) throws Exception;

    /**
     * 根据查出的临时表订单头id删除订单临时头、行表
     *
     * @param record
     * @throws Exception
     */
    public void deleteTempOrder(ImpOrder record) throws Exception;

    /**
     * 删除订单行临时表记录
     *
     * @param record
     * @throws Exception
     */
    public void deleteTempOrderItem(ImpOrder record) throws Exception;

    /**
     * 更新订单头
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderHeadUpdate(ImpOrder record) throws Exception;

    /**
     * 更新订单行
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderItemUpdate(ImpOrder record) throws Exception;

    /**
     * 校验导入数据
     *
     * @throws Exception
     */
    public void checkOrder() throws Exception;

    /**
     * 删除当前用户导入的所有订单数据
     *
     * @param record
     * @throws Exception
     */
    public void cancelImport(ImpOrder record) throws Exception;

    /**
     * 根据校验成功的订单生成对应的消费者、订单、产品
     *
     * @throws Exception
     */
    public void generateConsumer() throws Exception;
}
